package SickModel;

import SickModel.Classes.INameIPPort;
import java.util.ArrayList;

/**
 *
 * @author Pozytywny!
 */
public class SickModel implements ISickModel{
    private ArrayList<INameIPPort> _hosts = new ArrayList<INameIPPort>();

    public ArrayList<INameIPPort> getHostList() {
        return _hosts;
    }

    public void addHost(INameIPPort host) {
        _hosts.add(host);
    }

    public void removeHost(INameIPPort host) throws Exception{
        for(int i=0; i<_hosts.size();i++) {
            if(_hosts.get(i).equals(host)){
                _hosts.remove(i);
                break;
            }
            if(i==_hosts.size()-1)
                throw new Exception("Given host doesn't exist");
        }
    }

}
